package com.xbk.seckill.order.application.service.impl;

import com.xbk.seckill.order.application.service.OrderTaskGenerateService;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

/**
 * 生成订单下单请求标识实现类
 *
 * @author xiexu
 * @date 2025/3/2 17:19
 */
@Service
public class OrderTaskGenerateServiceImpl implements OrderTaskGenerateService {

    /**
     * 生成订单任务id
     *
     * @param userId  用户id
     * @param goodsId 商品id
     * @return
     */
    @Override
    public String generatePlaceOrderTaskId(Long userId, Long goodsId) {
        String toEncrypt = userId + "_" + goodsId;
        return DigestUtils.md5DigestAsHex(toEncrypt.getBytes());
    }

}
